import request from '@/utils/request'

// 登录
export const requestLogin = params => { return request({ url: '/user/login', method: 'post', data: params }).then(res => res.data); };

// 获取列表
export const getUserList = () => { return request({ url: '/user/query', method: 'get' }).then(res => res.data); };

// 获取redis配置列表
export const getRedisConfigList = () => { return request({ url: '/redis/config/query', method: 'get' }).then(res => res.data); };
// 新增配置
export const addRedisConfig = params => { return request({ url: '/redis/config/create', method: 'post', data: params }).then(res => res.data); };
// 编辑配置
export const editRedisConfig = params => { return request({ url: '/redis/config/update', method: 'post', data: params }).then(res => res.data); };
// 启用配置
export const enableRedisConfig = params => { return request({ url: '/redis/config/enabled?host=' + params, method: 'get' }).then(res => res.data); };
// 停用配置
export const disableRedisConfig = params => { return request({ url: '/redis/config/disabled?host=' + params, method: 'get' }).then(res => res.data); };
// 删除配置
export const deleteRedisConfig = params => { return request({ url: '/redis/config/delete?host=' + params, method: 'get' }).then(res => res.data); };
// 获取redis配置下拉框
export const getRedisConfigSelect = () => { return request({ url: '/redis/config/select', method: 'get' }).then(res => res.data); };

// 获取缓存redis详情
export const getCacheDetails = params => { return request({ url: '/redis/cache/details', method: 'post', data: params }).then(res => res.data); };
// 获取redis缓存列表
export const getRedisCacheList = params => { return request({ url: '/redis/cache/query', method: 'post', data: params }).then(res => res.data); };
// 添加redis
export const addRedisCache = params => { return request({ url: '/redis/cache/create', method: 'post', data: params }).then(res => res.data); };
// 删除缓存
export const removeCacheRedis = params => { return request({ url: '/redis/cache/delete', method: 'post', data: params }).then(res => res.data); };
// 更新名称
export const renameCacheRedis = params => { return request({ url: '/redis/cache/name/update', method: 'post', data: params }).then(res => res.data); };
// 更新过期时间
export const updateCacheRedisExpire = params => { return request({ url: '/redis/cache/expire/update', method: 'post', data: params }).then(res => res.data); };
// 更新值
export const updateCacheRedisValue = params => { return request({ url: '/redis/cache/value/update', method: 'post', data: params }).then(res => res.data); };
// 添加值
export const addCacheRedisValue = params => { return request({ url: '/redis/cache/value/create', method: 'post', data: params }).then(res => res.data); };
// 测试连接
export const testConnRedisConfig = params => { return request({ url: '/redis/config/test/conn', method: 'post', data: params }).then(res => res.data); };

export const selectRedisDb = params => { return request({ url: '/redis/config/select/db?host='+params, method: 'get', data: params }).then(res => res.data); };


// WEBPACK FOOTER //
// ./src/api/api.js